﻿using System;
using Microsoft.Xna.Framework;
using Terraria.GameContent.UI.Elements;
using Terraria.Localization;
using Terraria.UI;

namespace Terraria.ModLoader.UI
{
	// Token: 0x02000285 RID: 645
	internal class UIAdvancedInfoMessage : UIState
	{
		// Token: 0x06001A46 RID: 6726 RVA: 0x004288A8 File Offset: 0x00426AA8
		public override void OnInitialize()
		{
			UIElement uielement = new UIElement();
			uielement.Width.Set(0f, 0.8f);
			uielement.Top.Set(200f, 0f);
			uielement.Height.Set(-240f, 1f);
			uielement.HAlign = 0.5f;
			UIPanel uipanel = new UIPanel();
			uipanel.Width.Set(0f, 1f);
			uipanel.Height.Set(-110f, 1f);
			uipanel.BackgroundColor = new Color(33, 43, 79) * 0.8f;
			uielement.Append(uipanel);
			this.message.Width.Set(-25f, 1f);
			this.message.Height.Set(0f, 1f);
			uipanel.Append(this.message);
			UIScrollbar uiscrollbar = new UIScrollbar();
			uiscrollbar.SetView(100f, 1000f);
			uiscrollbar.Height.Set(-20f, 1f);
			uiscrollbar.VAlign = 0.5f;
			uiscrollbar.HAlign = 1f;
			uipanel.Append(uiscrollbar);
			this.message.SetScrollbar(uiscrollbar);
			UITextPanel<string> uitextPanel = new UITextPanel<string>(Language.GetTextValue("tModLoader.OK"), 0.7f, true);
			uitextPanel.Width.Set(-10f, 0.5f);
			uitextPanel.Height.Set(50f, 0f);
			uitextPanel.Left.Set(0f, 0f);
			uitextPanel.VAlign = 1f;
			uitextPanel.Top.Set(-30f, 0f);
			uitextPanel.OnMouseOver += UICommon.FadedMouseOver;
			uitextPanel.OnMouseOut += UICommon.FadedMouseOut;
			uitextPanel.OnClick += this.OKClick;
			uielement.Append(uitextPanel);
			this.button2 = new UITextPanel<string>("???", 0.7f, true);
			this.button2.Width.Set(-10f, 0.5f);
			this.button2.Height.Set(50f, 0f);
			this.button2.Left.Set(0f, 0.5f);
			this.button2.VAlign = 1f;
			this.button2.Top.Set(-30f, 0f);
			this.button2.OnMouseOver += UICommon.FadedMouseOver;
			this.button2.OnMouseOut += UICommon.FadedMouseOut;
			this.button2.OnClick += this.AltClick;
			uielement.Append(this.button2);
			base.Append(uielement);
		}

		// Token: 0x06001A47 RID: 6727 RVA: 0x00012BCA File Offset: 0x00010DCA
		public override void OnActivate()
		{
			this.button2.SetText(this.button2Text);
		}

		// Token: 0x06001A48 RID: 6728 RVA: 0x00012BDD File Offset: 0x00010DDD
		internal void SetMessage(string text)
		{
			this.message.SetText(text);
		}

		// Token: 0x06001A49 RID: 6729 RVA: 0x00012BEB File Offset: 0x00010DEB
		internal void SetAltMessage(string text)
		{
			this.button2Text = text;
		}

		// Token: 0x06001A4A RID: 6730 RVA: 0x00012BF4 File Offset: 0x00010DF4
		internal void SetAltAction(Action action)
		{
			this.altAction = action;
		}

		// Token: 0x06001A4B RID: 6731 RVA: 0x00012BFD File Offset: 0x00010DFD
		internal void SetGotoMenu(int gotoMenu)
		{
			this.gotoMenu = gotoMenu;
		}

		// Token: 0x06001A4C RID: 6732 RVA: 0x00012C06 File Offset: 0x00010E06
		private void OKClick(UIMouseEvent evt, UIElement listeningElement)
		{
			Main.PlaySound(10, -1, -1, 1, 1f, 0f);
			Main.menuMode = this.gotoMenu;
		}

		// Token: 0x06001A4D RID: 6733 RVA: 0x00012C28 File Offset: 0x00010E28
		private void AltClick(UIMouseEvent evt, UIElement listeningElement)
		{
			Main.PlaySound(10, -1, -1, 1, 1f, 0f);
			Action action = this.altAction;
			if (action != null)
			{
				action();
			}
			Main.menuMode = this.gotoMenu;
		}

		// Token: 0x04001784 RID: 6020
		private UIMessageBox message = new UIMessageBox("");

		// Token: 0x04001785 RID: 6021
		private int gotoMenu;

		// Token: 0x04001786 RID: 6022
		private Action altAction;

		// Token: 0x04001787 RID: 6023
		private UITextPanel<string> button2;

		// Token: 0x04001788 RID: 6024
		private string button2Text = "???";
	}
}
